#include<iostream>
#include<algorithm>
using namespace std;
struct TreeNode 
{
    int val;
    TreeNode* left;
    TreeNode* right;
    TreeNode() 
        : val(0), left(nullptr), right(nullptr) 
    {}
    TreeNode(int x) 
        : val(x), left(nullptr), right(nullptr) 
    {}
    TreeNode(int x, TreeNode* left, TreeNode* right) 
        : val(x), left(left), right(right) 
    {}

};
class Solution {
public:
    void sinarry(TreeNode* root, int& pre, int& res)
    {
        if (root == nullptr)
            return;
        sinarry(root->left, pre, res);
        if (pre == -1)
            pre = root->val;
        else
        {
            res = min(res, root->val - pre);
            pre = root->val;
        }
        sinarry(root->right, pre, res);
    }
    int minDiffInBST(TreeNode* root) {
        int min = -1;
        int res = INT_MAX;
        sinarry(root, min, res);
        return res;
    }
};
int main()
{
    return 0;
}